<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  <title>Document</title>
</head>
<style>
    .active{
        width: 200px;
    }
</style>
<body>
  <div id="app">
    当前分数：<span>{{count}}</span>
    <button v-on:click="add">+</button>
    <button @click="reduce">-</button>
    <hr/>

    <input type="text" v-model.trim="inputVal"  v-on:keyup.enter="enter">
    <p v-clock>input的value值：{{inputVal}}</p>

    <hr/>

    <img  v-bind:src="imgUrl":class="isOk ? 'active': ''" alt="">
  </div>

  <script>
    var app = new Vue({
      el: '#app', 
      data: {
        count: 0,
        inputVal: 0,
        imgUrl:'https://img0.baidu.com/it/u=1967997459,1022958762&fm=26&fmt=auto',
        className:'active',
        isOk:true
      },
      methods: {
        add() {
          this.count++
        },
        reduce() {
          this.count--
        },
        enter(e) {
          // if (e.keyCode === 13) {
          //   console.log(e.keyCode);
          // }
          console.log(e.keyCode);
        }
      }
    })
  </script>
</body>
</html>
